package cn.jx.asc.mqtt;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

/**
 * @author z423
 * @2021-06-13-17:14
 * @effect    mq客户端用到的实体类
 * @especial
 */

@Data
@Component
@PropertySource("classpath:config/onenet-mqttb.properties")
public class mqttProperties {

    private final Environment env;

    /**
     * 用户自定义合法的UTF-8字符串，可为空
     */
    private String clientId;

    /**
     * 服务器地址
     */
    private String serverUrl;

    /**
     * 实例名称
     */
    private String objName;

    /**
     * mqtt topic
     */
    private String mqTopic;

    /**
     * mqtt sub
     */
    private String mqSub;

    /**
     * mqtt access_key
     */
    private String accessKey;

    /**
     * 版本
     */
    private String version;

    /**
     * 签名方式
     */
    private String signatureMethod;

    @Autowired
    mqttProperties(Environment env){

        this.env = env;
        this.clientId = env.getProperty("clientId");
        this.serverUrl = env.getProperty("serverUrl");
        this.objName = env.getProperty("objName");
        this.mqTopic = env.getProperty("mqTopic");
        this.mqSub = env.getProperty("mqSub");
        this.accessKey = env.getProperty("accessKey");
        this.version = env.getProperty("version");
        this.signatureMethod = env.getProperty("signatureMethod");

    }

}
